package com.shop.exception;

import com.shop.vo.ResultJson;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class DefaultException {

    @ExceptionHandler
    public ResultJson handler(Exception e) {
        e.printStackTrace();
        if (e instanceof ShopException) {
            return ResultJson.failed(e.getMessage());
        }
        return ResultJson.failed("系统异常请联系管理员");
    }

}
